﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CarLoanSystemWeb.MasterPage;
using CarLoanSystem.Comman;
using CarLoanSystem.Entity;

namespace CarLoanSystemWeb.Page.EditProfile
{
    public partial class EditProfileDonsmanPage : System.Web.UI.Page
    {
        private static CustomerItem cusItem;
        protected void Page_Load(object sender, EventArgs e)
        {
            cusItem = Session["Member"] as CustomerItem;
            wuc_edit_profile_donsman1.InfoMessege += new EventHandler(Call_InfoMessage);
            wuc_edit_profile_donsman1.ErrorMessege += new EventHandler(Call_ErrorMessage);
            wuc_edit_profile_donsman1.ErrorMessegeName += new EventHandler(Call_ErrorMessageName);
        }

        private void Call_InfoMessage(object sender, EventArgs e)
        {
            InfoMessage("บันทึกข้อมูลเรียบร้อยแล้ว");
            Response.AppendHeader("Refresh", "2; url=../EditProfile/EditProfilePage.aspx");
        }

        private void Call_ErrorMessageName(object sender, EventArgs e)
        {
            ErrorMessage("ผู้ค้ำประกันนี้มีการค้ำประกันการขอกู้อื่นแล้ว");
        }

        private void Call_ErrorMessage(object sender, EventArgs e)
        {
            ErrorMessage(sender.ToString());
        }

        private void InfoMessage(string msg)
        {
            ((MainMasterPage)this.Master).ShowInfoMessage(msg);
        }

        private void ErrorMessage(string msg)
        {
            ((MainMasterPage)this.Master).ShowErrorMessage(msg);
        }
    }
}